﻿/*
Upgrade script for Nop Anywhere Sliders for nopCommerce 2.60
*/

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[SliderWidget_Slider]') AND parent_object_id = OBJECT_ID(N'[dbo].[SliderWidget]'))
ALTER TABLE [dbo].[SliderWidget] DROP CONSTRAINT [SliderWidget_Slider]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SliderWidget]') AND type in (N'U'))
DROP TABLE [dbo].[SliderWidget]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SliderWidget](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[SliderId] [int] NOT NULL,
	[WidgetZone] [nvarchar](max) NOT NULL,
	[DisplayOrder] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[SliderWidget]  WITH CHECK ADD  CONSTRAINT [SliderWidget_Slider] FOREIGN KEY([SliderId])
REFERENCES [dbo].[AnywhereSlider] ([Id])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[SliderWidget] CHECK CONSTRAINT [SliderWidget_Slider]
GO
